<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Logo</title>
    <link rel="stylesheet" href="./style.css">
</head>
<body>
    <div class="navigation">
        <ul>
            <li class="list active">
                <a href="#">
                    <span class="icon">
                        <ion-icon name="logo-twitter"></ion-icon>
                    </span>
                    <span class="text">Twitter</span>
                </a>
            </li>
            <li class="list">
                <a href="#">
                    <span class="icon">
                        <ion-icon name="logo-wechat"></ion-icon>
                    </span>
                    <span class="text">WeChat</span>
                </a>
            </li>
            <li class="list">
                <a href="#">
                    <span class="icon">
                        <ion-icon name="logo-linkedin"></ion-icon>
                    </span>
                    <span class="text">Linkedin</span>
                </a>
            </li>
            <li class="list">
                <a href="#">
                    <span class="icon">
                        <ion-icon name="logo-apple"></ion-icon>
                    </span>
                    <span class="text">Apple</span>
                </a>
            </li>
            <li class="list">
                <a href="#">
                    <span class="icon">
                        <ion-icon name="logo-youtube"></ion-icon>
                    </span>
                    <span class="text">YouTube</span>
                </a>
            </li>
            <div class="indicator"></div>
        </ul>
    </div>

    <script>
        const lists = document.querySelectorAll('.list');
        function setactiveClass(){
            lists.forEach((item)=>{
                // 排他思想
                item.classList.remove('active');
                // 箭头函数 this指向上层作用域函数的调用者
                this.classList.add('active');
            });
        }

        lists.forEach((item)=>{
            item.addEventListener("mouseover",setactiveClass);
        });
    </script>


    <script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
    <script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
</body>
</html>